#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <math.h>

float calc(int n, float x) {
	return n == 0? x : sqrt((float) n + calc(n-1, x));
}

int main() {
	int n;
	scanf("%d", &n);

	int cnt;
	float x;
	while (n-- > 0) {
		scanf("%d %f", &cnt, &x);
		printf("%.3f\n", calc(cnt, x));
	}
}
